<template>
  <el-table :data="tableData" style="width: 100%">
    <el-table-column prop="id" label="ID" width="180"/>
    <el-table-column prop="name" label="姓名" width="180"/>
    <el-table-column prop="job" label="岗位"/>
    <el-table-column prop="sal" label="薪资"/>
    <el-table-column prop="comm" label="奖金"/>
  </el-table>
</template>

<script setup>
import {ref, onMounted} from "vue";
import axios from 'axios'
const tableData= ref([])  // 定义一个变量
//当页面加载时执行onMounted函数，
onMounted( ()=> {
  axios.get('http://localhost:8080/v1/emp/getEmps').then((res)=>{
    console.log("返回的数据：" + res.data);
    tableData.value = res.data
  })
} )


</script>

<style scoped>

</style>